package com.dao;

import java.util.List;

import org.hibernate.Query;
import org.springframework.stereotype.Repository;

import com.entity.WorklogEntity;

@Repository
public class WorklogDaoImpl extends GenericDaoImpl<WorklogEntity> implements
		WorklogDao {

	public WorklogEntity getWorklogById(int id) {
		return getById(WorklogEntity.class, id);
	}

	public List<WorklogEntity> getAllWorklog() {
		return getAll(WorklogEntity.class);
	}

	public int getMaxWorklog() {
		String hql = "Select max(idWorklog) From WorklogEntity";
		Query query = sessionFactory.getCurrentSession().createQuery(hql);
		return (Integer) query.uniqueResult();
	}
	
	public long getCountWorklog(){
		String hql = "Select count(idWorklog) From WorklogEntity";
		Query query = sessionFactory.getCurrentSession().createQuery(hql);
		return (Long) query.uniqueResult();
	}

}
